package com.cn.sl.server.api.system.user.model.dto

import io.swagger.v3.oas.annotations.media.Schema
import jakarta.validation.constraints.NotBlank

@Schema(description = "登录参数")
class LoginParam(
    /**
     * 用户名
     */
    @field:Schema(description = "用户名", required = true)
    @get:NotBlank(message = "用户名不能为空")
    var username: String?,
    /**
     * 密码
     */
    @field:Schema(description = "密码", required = true)
    @get:NotBlank(message = "密码不能为空")
    var password: String?,
    /**
     * 记住我
     */
    @field:Schema(description = "记住我", defaultValue = "false")
    var rememberMe: Boolean = false,
    /**
     * 登录客户端
     */
    @field:Schema(description = "登录客户端", defaultValue = "WEB")
    var client: String = "WEB"
) {
    fun toDto(): LoginDto {
        return LoginDto(username!!, password!!, rememberMe)
    }
}

data class LoginDto(
    /**
     * 用户名
     */
    val username: String,
    /**
     * 密码
     */
    val password: String,
    /**
     * 记住我
     */
    val rememberMe: Boolean = false,
    /**
     * 登录客户端
     */
    var client: String = "WEB"
)